package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Lianshou;
import com.ruoyi.system.service.ILianshouService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 没啥用Controller
 * 
 * @author 吴思恒
 * @date 2024-12-11
 */
@RestController
@RequestMapping("/system/lianshou")
public class LianshouController extends BaseController
{
    @Autowired
    private ILianshouService lianshouService;

    /**
     * 查询没啥用列表
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:list')")
    @GetMapping("/list")
    public TableDataInfo list(Lianshou lianshou)
    {
        startPage();
        List<Lianshou> list = lianshouService.selectLianshouList(lianshou);
        return getDataTable(list);
    }

    /**
     * 导出没啥用列表
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:export')")
    @Log(title = "没啥用", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Lianshou lianshou)
    {
        List<Lianshou> list = lianshouService.selectLianshouList(lianshou);
        ExcelUtil<Lianshou> util = new ExcelUtil<Lianshou>(Lianshou.class);
        util.exportExcel(response, list, "没啥用数据");
    }

    /**
     * 获取没啥用详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(lianshouService.selectLianshouById(id));
    }

    /**
     * 新增没啥用
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:add')")
    @Log(title = "没啥用", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Lianshou lianshou)
    {
        return toAjax(lianshouService.insertLianshou(lianshou));
    }

    /**
     * 修改没啥用
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:edit')")
    @Log(title = "没啥用", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Lianshou lianshou)
    {
        return toAjax(lianshouService.updateLianshou(lianshou));
    }

    /**
     * 删除没啥用
     */
    @PreAuthorize("@ss.hasPermi('system:lianshou:remove')")
    @Log(title = "没啥用", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(lianshouService.deleteLianshouByIds(ids));
    }
}
